package com.gzq.administrator.testsvg;

import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.ImageView;

import com.eftimoff.androipathview.PathView;

public class MainActivity extends AppCompatActivity {
    private ImageView svg;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        svg = findViewById(R.id.svg);
        Drawable drawable = svg.getDrawable();
        if (drawable instanceof Animatable) {
            ((Animatable) drawable).start();
        }
        PathView pathView = findViewById(R.id.path);
        pathView.setFillAfter(true);
        pathView.useNaturalColors();

        pathView.getPathAnimator()
                .delay(100)
                .duration(1500)
//                .listenerStart(new PathView.AnimatorBuilder.ListenerStart() {
//                    @Override
//                    public void onAnimationStart() {
//
//                    }
//                })
//                .listenerEnd(new PathView.AnimatorBuilder.ListenerEnd() {
//                    @Override
//                    public void onAnimationEnd() {
//
//                    }
//                })
                .interpolator(new AccelerateDecelerateInterpolator())
                .start();
    }
}
